// import 'babel-polyfill'
// import '@babel/polyfill'
import Vue from 'vue'
import Cookies from 'js-cookie'

import 'normalize.css/normalize.css'

import Element from 'element-ui'
//
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
import {
  zh,
  en,
  tw,
  lang
} from '@/locale'
import VueI18n from 'vue-i18n'
import Print from 'vue-print-nb'

// 权限指令
import permission from './components/Permission'
import './assets/styles/element-variables.scss'
// global css
import './assets/styles/index.scss'

// 代码高亮
import VueHighlightJS from 'vue-highlightjs'
import 'highlight.js/styles/atom-one-dark.css'

import App from './App'
import store from './store'
import router from './router/routers'
import 'jquery'
import './assets/icons' // icon
import './router/index' // permission control
import 'echarts-gl'


  
import errorImg from '@/assets/js/errorImg.js';
Vue.prototype.testPM = errorImg;
// 过滤器
import * as filters from '@/assets/js/fifter.js'
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})
const messages = {
  'zh-CN': zh,
  'en-US': en,
  'zh-TW': tw
}
const i18n = new VueI18n({
  locale: lang, // 语言标识
  messages,
  silentTranslationWarn: true
})
Vue.use(VueHighlightJS)
Vue.use(mavonEditor)
Vue.use(permission)
Vue.use(Print)
Vue.use(Element, {
  i18n: (key, value) => i18n.t(key, value),
  size: Cookies.get('size') || 'medium' // set element-ui default size
})

Vue.config.productionTip = false
Element.Dialog.props.top.default = '0%'; //Dialog CSS 中的 margin-top 值 设置为弹窗居中显示

Element.TableColumn.props.resizable.default = true // 生效 全局配置表格是否显示表头
Element.TableColumn.props.align.default = 'center' // 生效 全局配置表格是否显示居中
Element.TableColumn.props.showOverflowTooltip.default = true //当内容过长被隐藏时显示

Element.Table.props.stripe.default = true; //是否为斑马纹 table
// Element.Table.props.headerCellClassName.default = 'table-head-name' 
Element.Table.props.headerCellStyle.default = function () {
  return {
    'background': '#fafdff'
  }
} // 生效 全局配置表格表头设置颜色
import common from '@/utils/permission'
Vue.use(common);

import btnTip from '@/components/Common/btnTip'
Vue.component("btn-tip", btnTip)
import queryBtn from "@/components/Common/queryBtn";
Vue.component("query-btn", queryBtn)
import pagination from "@/components/Pagination";
Vue.component("pagination", pagination)



import Tinymce from '@/components/tinymce/index.vue'

Vue.component('tinymce', Tinymce)

import date from '@/components/date/index'
import switchradio from '@/components/switchradio/index'


Vue.component('el-date', date)
Vue.component('switch-radio', switchradio)

import password from '@/components/password/index'
Vue.component('pass-word', password)

const vm = new Vue({
  el: '#app',
  router,
  store,
  i18n,
  render: h => h(App),
  // 空的实例放到根组件下，所有的子组件都能调用
  data: {
    Hub: new Vue()
  }
})
export default vm;
